package com.hyl.jspdemo.config;

import com.hyl.jspdemo.filter.LoginValidateFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description 配置过滤器
 * @Author hyl
 * @Date 2022/5/31 15:50
 **/
@Configuration
public class FilterConfig {

	@Bean
	public FilterRegistrationBean filterRegistrationBean(){
		FilterRegistrationBean registrationBean = new FilterRegistrationBean();
		registrationBean.setFilter(new LoginValidateFilter()); //添加过滤器
		registrationBean.setName("LoginValidateFilter"); //设置名称
		registrationBean.addUrlPatterns("/main","/user/*");
		registrationBean.setOrder(5); //顺序
		return registrationBean;
	}


}
